﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;
using System.Text;

namespace IHISCETeim.Web.MachineSys.XZModel
{
    public partial class XZKaoQinTJReport : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看, Permission.导出 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "XZKaoQinTJReport";
            }
        }
        #region 属性 (查询条件)

        protected int Year
        {
            get
            {
                return GetRequestValue<int>("year", DateTime.Now.Year);
            }
        }
        protected int Month
        {
            get
            {
                return GetRequestValue<int>("Month", DateTime.Now.Month);
            }
        }

        protected string colMonth
        {
            get
            {
                return Year.ToString() + "-" + Month.ToString();
            }
        }
        protected DateTime stated
        {
            get
            {
                return Convert.ToDateTime(colMonth);
            }
        }

        protected DateTime endd
        {
            get
            {
                return stated.AddMonths(1).AddDays(-1);
            }
        }




        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            DataBind();
            
            
            AddLog(Permission.查看);
        }
        /// <summary>
        /// 当前排序字段
        /// </summary>
        protected override string orderField
        {
            get
            {
                return string.IsNullOrEmpty(base.orderField) ? "GongHao" : base.orderField;
            }
        }
        /// <summary>
        /// 当前排序方式
        /// </summary>
        protected override string orderDirection
        {
            get
            {
                return string.IsNullOrEmpty(base.orderDirection) ? "Desc" : base.orderDirection;
            }
        }
        protected void DataBind()
        {
            DataTable DTC =  XZKaoQinController.GetTJReport(stated, endd);
           

            DTC.DefaultView.Sort = SQLSort;

            this.rpMenu.DataSource = DTC.DefaultView;
            this.rpMenu.DataBind();
            
        }

        protected string GetYearList()
        {
            string liTemplete = "<option value='{0}' {1}>{0}年</option>";
            string rHtml = "";
            int nowYear = DateTime.Now.Year;
            for (int i = (nowYear - 3); i <= nowYear; i++)
            {
                rHtml = rHtml + string.Format(liTemplete, i, i == Year ? "selected" : "");
            }
            return rHtml;
        }


        
    }
}